home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The World of Computer Software
/
The World of Computer Software.iso
/
dec92.zip
/
1012023A
< prev
next >
Wrap
Text File
|
1992-10-13
|
1KB
|
48 lines
/*
* REAL_ISR.C Copyright (C) 1992 Mark R. Nelson.
*
* This header file contains the source code for the real time
* interrupt service routine used in the TERM286.H program.
* It also contains the only copy of the data structure used to
* access the UART.
*
*/
#include <dos.h>
#include <conio.h>
#include "phapi.h"
#include "term286.h"
/*
* This is the data structure used by both the real and protected
* mode interrupt service routines.
*/
struct port_data Port;
/*
* This is the real mode ISR. It is identical to the protected mode
* ISR, except for the increment of the real mode interrupt count
* near the end. This routine reads in the character that caused the
* interrupt, then tries to stuff it in the buffer and update the
* head pointer. Finally, it increments the diagnostic counter,
* outputs an EOI to the 8259 PIC, and exits.
*/
void far interrupt real_isr()
{
unsigned char c;
int space_used;
c = ( unsigned char ) inp( Port.uart_address );
space_used = Port.head_pointer - Port.tail_pointer;
if ( space_used < 0 )
space_used += 1024;
if ( space_used < 1023 ) {
Port.buffer[ Port.head_pointer++ ] = c;
Port.head_pointer &= 1023;
}
Port.real_count++;
(void) outp( 0x20, 0x20 );
}